package com.atguigu.gmall.controller;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.atguigu.gmall.bean.ProductStats;
import org.apache.commons.lang3.StringUtils;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

public class Demo {
    public static void main(String[] args) {
        List<String> tradeMarkList = new ArrayList<>();
        List<BigDecimal> amountList = new ArrayList<>();
        for(int i=0;i<10;i++){
            tradeMarkList.add("小米"+i);
            amountList.add(new BigDecimal(i));
        }

        String json = "{\"status\":0,\"data\":{\"categories\":" +
                "[\"" + StringUtils.join(tradeMarkList,"\",\"") + "\"],\"series\":["
                +"{\"data\":["+ StringUtils.join(amountList,",") +"]}]}}";
        System.out.println(json);

    }

    public static JSONObject getKV(String key1,String value1,String key2,String value2){
        JSONObject jsonObject = new JSONObject();
        jsonObject.put(key1,value1);
        jsonObject.put(key2,value2);
        return jsonObject;
    }
}
